<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增活动信息')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form">
        <div class="form-group">
            <label class="col-sm-3 control-label">参与时长：</label>
            <div class="col-sm-8">
                <input name="appraiseTime" class="form-control" type="text" required>
                <input name="enrollId" th:value="${enrollId}" type="hidden">
                <input name="appraiseId" th:value="${appraiseId}" type="hidden">
                <input name="appraiseState" value="2" type="hidden">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">活动表现：</label>
            <div class="col-sm-8" id="star">
                <span class="glyphicon glyphicon-star-empty"></span>
                <span class="glyphicon glyphicon-star-empty"></span>
                <span class="glyphicon glyphicon-star-empty"></span>
                <span class="glyphicon glyphicon-star-empty"></span>
                <span class="glyphicon glyphicon-star-empty"></span>
                <input name="appraiseScore" id="appraiseScore" type="hidden">
                <input name="memberState" type="hidden" value="1">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">评价内容：</label>
            <div class="col-sm-8">
                <textarea name="appraiseContent" class="form-control"></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script type="text/javascript">
    var prefix = ctx + "vtsp/appraise"
    $("#form").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form').serialize());
        }
    }

    $('#star').on('mousedown','.glyphicon',function(){
        let score = 0;
        if($(this).hasClass('glyphicon-star')){
            $(this).addClass('glyphicon-star-empty').removeClass('glyphicon-star').siblings('.glyphicon').addClass('glyphicon-star-empty').removeClass('glyphicon-star');
        }else{
            score = $(this).index();
            $(this).addClass('glyphicon-star').removeClass('glyphicon-star-empty').prevAll('.glyphicon').addClass('glyphicon-star').removeClass('glyphicon-star-empty');
        }
        $('#appraiseScore').val(score);
    });

</script>
</body>
</html>